/*******************************************************************************
 * Size: 38 px
 * Bpp: 1
 * Opts: --bpp 1 --size 38 --no-compress --font AlibabaPuHuiTi-3-115-Black.ttf --symbols 哈喽世界 --format lvgl -o ali.c
 ******************************************************************************/

#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "../lvgl/lvgl.h"
#endif

#ifndef ALI
#define ALI 1
#endif

#if ALI

/*-----------------
 *    BITMAPS
 *----------------*/

/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
    /* U+4E16 "世" */
    0x1f, 0x87, 0xe0, 0xfc, 0x7, 0xe1, 0xf8, 0x3f,
    0x1, 0xf8, 0x7e, 0xf, 0xc0, 0x7e, 0x1f, 0x83,
    0xf0, 0x1f, 0x87, 0xe0, 0xfc, 0x7, 0xe1, 0xf8,
    0x3f, 0x1, 0xf8, 0x7e, 0xf, 0xc3, 0xff, 0xff,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7,
    0xe1, 0xf8, 0x3f, 0x1, 0xf8, 0x7e, 0xf, 0xc0,
    0x7e, 0x1f, 0x83, 0xf0, 0x1f, 0x87, 0xe0, 0xfc,
    0x7, 0xe1, 0xf8, 0x3f, 0x1, 0xf8, 0x7e, 0xf,
    0xc0, 0x7e, 0x1f, 0xff, 0xf0, 0x1f, 0x87, 0xff,
    0xfc, 0x7, 0xe1, 0xff, 0xff, 0x1, 0xf8, 0x7f,
    0xff, 0xc0, 0x7e, 0x1f, 0xff, 0xf0, 0x1f, 0x87,
    0xff, 0xfc, 0x7, 0xe0, 0x0, 0x0, 0x1, 0xf8,
    0x0, 0x0, 0x0, 0x7e, 0x0, 0x0, 0x0, 0x1f,
    0xff, 0xff, 0xff, 0x7, 0xff, 0xff, 0xff, 0xc1,
    0xff, 0xff, 0xff, 0xf0, 0x7f, 0xff, 0xff, 0xfc,
    0x1f, 0xff, 0xff, 0xff, 0x7, 0xff, 0xff, 0xff,
    0xc0,

    /* U+54C8 "哈" */
    0x0, 0x0, 0x1f, 0xc0, 0x0, 0x0, 0x7, 0xf0,
    0xf, 0xff, 0x3, 0xfe, 0x3, 0xff, 0xc1, 0xff,
    0xc0, 0xff, 0xf0, 0x7f, 0xf0, 0x3f, 0xfc, 0x3f,
    0x7e, 0xf, 0xff, 0x1f, 0xdf, 0xc3, 0xff, 0xcf,
    0xe3, 0xf8, 0xf8, 0xf7, 0xf0, 0x7f, 0x3e, 0x3f,
    0xfc, 0xf, 0xff, 0x8f, 0xff, 0xff, 0xfb, 0xe3,
    0xff, 0xff, 0xfe, 0xf8, 0xf7, 0xff, 0xff, 0x3e,
    0x3d, 0xbf, 0xfe, 0xcf, 0x8f, 0xf, 0xff, 0x83,
    0xe3, 0xc0, 0x0, 0x0, 0xf8, 0xf0, 0x0, 0x0,
    0x3e, 0x3c, 0x0, 0x0, 0xf, 0x8f, 0x0, 0x0,
    0x3, 0xe3, 0xcf, 0xff, 0xf8, 0xf8, 0xf3, 0xff,
    0xfe, 0x3e, 0x3c, 0xff, 0xff, 0x8f, 0x8f, 0x3f,
    0xff, 0xe3, 0xe3, 0xcf, 0xff, 0xf8, 0xf8, 0xf3,
    0xe0, 0x3e, 0x3e, 0x3c, 0xf8, 0xf, 0x8f, 0xff,
    0x3e, 0x3, 0xe3, 0xff, 0xcf, 0x80, 0xf8, 0xff,
    0xf3, 0xe0, 0x3e, 0x3f, 0xfc, 0xf8, 0xf, 0x8f,
    0xff, 0x3f, 0xff, 0xe3, 0xff, 0xcf, 0xff, 0xf8,
    0x0, 0x3, 0xff, 0xfe, 0x0, 0x0, 0xff, 0xff,
    0x80, 0x0, 0x3f, 0xff, 0xe0,

    /* U+55BD "喽" */
    0x0, 0x0, 0x8f, 0x88, 0x0, 0x0, 0xe3, 0xe3,
    0x8f, 0xfe, 0x7c, 0xf9, 0xf3, 0xff, 0x9f, 0x3e,
    0xfc, 0xff, 0xe3, 0xef, 0xbe, 0x3f, 0xf8, 0xf3,
    0xe7, 0x8f, 0xfe, 0xff, 0xff, 0xfb, 0xff, 0xbf,
    0xff, 0xfe, 0xf9, 0xef, 0xff, 0xff, 0xbe, 0x7b,
    0xff, 0xff, 0xef, 0x9e, 0xff, 0xff, 0xfb, 0xe7,
    0x81, 0xff, 0xc0, 0xf9, 0xe1, 0xff, 0xfc, 0x3e,
    0x7b, 0xff, 0xff, 0xef, 0x9f, 0xff, 0xff, 0xff,
    0xe7, 0xbf, 0xbe, 0xfe, 0xf9, 0xef, 0xcf, 0x9f,
    0xbe, 0x79, 0xc0, 0x1, 0xef, 0x9e, 0x43, 0xf0,
    0x13, 0xe7, 0xbf, 0xff, 0xff, 0xf9, 0xef, 0xff,
    0xff, 0xfe, 0x7b, 0xff, 0xff, 0xff, 0x9e, 0xff,
    0xff, 0xff, 0xe7, 0xbf, 0xff, 0xff, 0xf9, 0xe1,
    0xf8, 0xfc, 0x3f, 0xf8, 0xfe, 0x3f, 0xf, 0xfe,
    0x3f, 0xff, 0x83, 0xff, 0x8f, 0xff, 0xe0, 0xff,
    0xe0, 0xff, 0xf8, 0x3f, 0xf8, 0x7f, 0xff, 0xcf,
    0xff, 0xff, 0xff, 0xfc, 0x0, 0x7f, 0xff, 0xfe,
    0x0, 0xf, 0xfc, 0x7f, 0x80, 0x3, 0xfc, 0x3,
    0xc0, 0x0, 0xf8, 0x0, 0x30,

    /* U+754C "界" */
    0xf, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff,
    0xf8, 0xf, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff,
    0xff, 0xf8, 0xf, 0xff, 0xff, 0xff, 0x80, 0xfc,
    0xf, 0xc1, 0xf8, 0xf, 0xc0, 0xfc, 0x1f, 0x80,
    0xff, 0xff, 0xff, 0xf8, 0xf, 0xff, 0xff, 0xff,
    0x80, 0xff, 0xff, 0xff, 0xf8, 0xf, 0xc0, 0xfc,
    0x1f, 0x80, 0xfc, 0xf, 0xc1, 0xf8, 0xf, 0xff,
    0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xf8, 0xf,
    0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xf8,
    0x0, 0xf, 0xff, 0x80, 0x0, 0x3, 0xff, 0xfe,
    0x0, 0x0, 0xff, 0xff, 0xf8, 0x0, 0x7f, 0xfc,
    0xff, 0xf0, 0x3f, 0xff, 0x3, 0xff, 0xe7, 0xff,
    0xc0, 0x1f, 0xff, 0x7f, 0xff, 0x3, 0xff, 0xf3,
    0xff, 0xf0, 0x3f, 0xfe, 0x3f, 0xbf, 0x3, 0xff,
    0xe1, 0xc3, 0xf0, 0x3f, 0x1c, 0x10, 0x7f, 0x3,
    0xf0, 0x40, 0x7, 0xf0, 0x3f, 0x0, 0x0, 0xfe,
    0x3, 0xf0, 0x0, 0x1f, 0xe0, 0x3f, 0x0, 0x3,
    0xfc, 0x3, 0xf0, 0x0, 0xff, 0xc0, 0x3f, 0x0,
    0x1f, 0xf8, 0x3, 0xf0, 0x0, 0x1e, 0x0, 0x3f,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0
};


/*---------------------
 *  GLYPH DESCRIPTION
 *--------------------*/

static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
    {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
    {.bitmap_index = 0, .adv_w = 602, .box_w = 34, .box_h = 34, .ofs_x = 2, .ofs_y = -3},
    {.bitmap_index = 145, .adv_w = 602, .box_w = 34, .box_h = 35, .ofs_x = 3, .ofs_y = -4},
    {.bitmap_index = 294, .adv_w = 602, .box_w = 34, .box_h = 35, .ofs_x = 2, .ofs_y = -4},
    {.bitmap_index = 443, .adv_w = 602, .box_w = 36, .box_h = 35, .ofs_x = 0, .ofs_y = -5}
};

/*---------------------
 *  CHARACTER MAPPING
 *--------------------*/

static const uint16_t unicode_list_0[] = {
    0x0, 0x6b2, 0x7a7, 0x2736
};

/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
    {
        .range_start = 19990, .range_length = 10039, .glyph_id_start = 1,
        .unicode_list = unicode_list_0, .glyph_id_ofs_list = NULL, .list_length = 4, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
    }
};



/*--------------------
 *  ALL CUSTOM DATA
 *--------------------*/

#if LVGL_VERSION_MAJOR == 8
/*Store all the custom data of the font*/
static  lv_font_fmt_txt_glyph_cache_t cache;
#endif

#if LVGL_VERSION_MAJOR >= 8
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
    .glyph_bitmap = glyph_bitmap,
    .glyph_dsc = glyph_dsc,
    .cmaps = cmaps,
    .kern_dsc = NULL,
    .kern_scale = 0,
    .cmap_num = 1,
    .bpp = 1,
    .kern_classes = 0,
    .bitmap_format = 0,
#if LVGL_VERSION_MAJOR == 8
    .cache = &cache
#endif
};



/*-----------------
 *  PUBLIC FONT
 *----------------*/

/*Initialize a public general font descriptor*/
#if LVGL_VERSION_MAJOR >= 8
const lv_font_t aliFont = {
#else
lv_font_t aliFont = {
#endif
    .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt,    /*Function pointer to get glyph's data*/
    .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt,    /*Function pointer to get glyph's bitmap*/
    .line_height = 36,          /*The maximum line height required by the font*/
    .base_line = 5,             /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
    .subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
    .underline_position = -3,
    .underline_thickness = 2,
#endif
    .dsc = &font_dsc,          /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
#if LV_VERSION_CHECK(8, 2, 0) || LVGL_VERSION_MAJOR >= 9
    .fallback = NULL,
#endif
    .user_data = NULL,
};



#endif /*#if ALI*/

